package pizzadroid.googlecode.com;

import resturant.pizzadroid.googlecode.com.*;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

// Byta till String till någon klass som representerar en pizzeria?
public class FavoritesAdapter extends ArrayAdapter<Resturant> {
	public FavoritesAdapter(Context context, int textViewResourceId) {
		super(context, textViewResourceId);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View v = convertView;
		if (v == null) {
			LayoutInflater vi = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			v = vi.inflate(R.layout.favorites_listitem, null);
		}
		Resturant r = getItem(position);
		if (r != null) {
			TextView text = (TextView) v.findViewById(R.id.favorites_list_text);
			if (text != null) {
				text.setText(r.name);
			}
		}
		return v;
	}
}